package Level02_one;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        //定义 QQ 号码数组 String[] strs
        String[] strs = {"12345","67891","2347809933","98765432102","67891","12347809933"};
        ArrayList<Object> objects = new ArrayList<>();
        //创建 LinkedList
        Collection<String> LinkedList = new ArrayList<>();
        //遍历 strs 获取每个 qq 号码
        for (String str : strs) {
            //将strs的元素添加到LinkedList中
            if (!LinkedList.contains(str)) {
                LinkedList.add(str);
            }
        }
        //遍历LinkedList所有元素
        for (String s : LinkedList) {
            System.out.println("通过增强for遍历数组："+s);
        }
        //获取集合迭代器
        Iterator<String> iterator = LinkedList.iterator();
        //遍历集合
        while(iterator.hasNext()){
            System.out.println("通过迭代器遍历数组："+iterator.next());
        }

    }
}
